package com.sinosoft.ptas.service.impl;

import java.util.List;
import java.util.UUID;

import org.springframework.stereotype.Service;

import com.sinosoft.ptas.dao.ProjectCotegoryMapper;
import com.sinosoft.ptas.dao.TargetAttributeMapper;
import com.sinosoft.ptas.entity.ProjectCotegoryEntity;
import com.sinosoft.ptas.service.ProjectCotegoryService;

/**
 * service层实现
 * @author zhangxiaolong
 *
 */
@Service
public class ProjectCotegoryServiceImpl implements ProjectCotegoryService {

	ProjectCotegoryMapper projectCotegoryMapper;
	
	public void setProjectCotegoryMapper(ProjectCotegoryMapper projectCotegoryMapper) {
		this.projectCotegoryMapper = projectCotegoryMapper;
	}

	TargetAttributeMapper targetAttributeMapper;
	
	public void setTargetAttributeMapper(TargetAttributeMapper targetAttributeMapper) {
		this.targetAttributeMapper = targetAttributeMapper;
	}

	/**
	 * 添加单个项目种类
	 * @return 实体编号
	 */
	public String createProjectCotegory(ProjectCotegoryEntity projectCotegoryEntity) {
		String id=UUID.randomUUID().toString();
		projectCotegoryEntity.setId(id);
		projectCotegoryMapper.createProjectCotegory(projectCotegoryEntity);
		return id;
	}

	/**
	 * 根据项目类型编号删除项目类型
	 * @param id
	 */
	public void deleteProjectCotegory(String id) {
		targetAttributeMapper.deleteTargetAttributeByPcid(id);
		projectCotegoryMapper.deleteProjectCotegory(id);
	}

	/**
	 * 根据项目类型编号修改项目种类
	 * @param projectCotegoryEntity
	 */
	public void updateProjectCotegory(ProjectCotegoryEntity projectCotegoryEntity) {
		projectCotegoryMapper.updateProjectCotegory(projectCotegoryEntity);
	}

	/**
	 * 多条件查询项目类型
	 * @return 项目类型集合
	 */
	public List<ProjectCotegoryEntity> retieveProjectCotegorys() {
		return projectCotegoryMapper.retieveProjectCotegorys();
	}

	/**
	 * 根据项目类型编号查询项目类型
	 * @param id
	 * @return 项目类型实体
	 */
	public ProjectCotegoryEntity retieveProjectCotegory(String id) {
		return projectCotegoryMapper.retieveProjectCotegory(id);
	}

}
